//
//  LSSyncEngine.h
//  LibraryStorm
//
//  Created by Enel@Lightning on 3/26/14.
//  Copyright (c) 2014 3ATeam. All rights reserved.
//

#import <Foundation/Foundation.h>
@class AFHTTPRequestOperation;
@protocol LSSyncEngineDelegate;

typedef enum {
    LSObjectSynced = 0,
} LSObjectSyncStatus;

@interface LSSyncEngine : NSObject

@property (atomic, readonly) BOOL syncInProgress;
@property (nonatomic, weak) id <LSSyncEngineDelegate> delegate;
+ (LSSyncEngine *)sharedEngine;

- (void)registerNSManagedObjectClassToSync:(Class)aClass;
- (void)startSync;
- (void)syncDataForRegisteredObject:(NSString *)className
                 toUseUpdatedAtDate:(BOOL)useUpdatedAtDate
               toDeleteLocalRecords:(BOOL)toDelete
                   withCategoryType:(int)categoryId
                       limitRecords:(int)limit
                    skipOverRecords:(int)skip;
@end

@protocol LSSyncEngineDelegate <NSObject>

@optional
// Successful Sync
- (void)syncEngine:(LSSyncEngine *)syncEngine forRegisteredObject:(NSString *)className toUseUpdatedAtDate:(BOOL)useUpdatedAtDate;
// Failed Sync
- (void)syncEngine:(LSSyncEngine *)syncEngine withError:(NSError *)error toUseUpdatedAtDate:(BOOL)useUpdatedAtDate;
@end